#ifndef TASK_HH_
# define TASK_HH_
# include "../Planet.hh"

# define TASK(CLASS)                                                    \
    class World::Planet::CLASS: public Task {                           \
        public: explicit CLASS(u8 amount = 1);                          \
                                                                        \
        protected: virtual void build(Planet& planet, u8 itemCount);    \
        protected: virtual u8 money_cost() const;                       \
        protected: virtual u8 work_cost() const;                        \
    }                                                                   \

# define TASK_DEF(CLASS, MONEY, WORK)       \
    using namespace World;                  \
                                            \
    Planet::CLASS::CLASS(u8 amount):        \
        Task(#CLASS, amount) {}             \
                                            \
    u8 Planet::CLASS::money_cost() const {  \
        return (MONEY);                     \
    }                                       \
                                            \
    u8 Planet::CLASS::work_cost() const {   \
        return (WORK);                      \
    }                                       \


class World::Planet::Task {
    protected: QString const name;
    protected: u8 amount;
    protected: u8 work;
    protected: u8 money;

    public: explicit Task(QString const& name, u8 amount);

    public: virtual bool execute(Planet& planet);
    protected: virtual void build(Planet& planet, u8 itemCount) = 0;
    protected: virtual u8 money_cost() const = 0;
    protected: virtual u8 work_cost() const = 0;
    public: QString get_name() const;
    public: u8 get_amount() const;
};

#endif /* TASK_HH_ */
